import { dataAxios } from "../rudexRou/request.js";

//======================数据配置======================
//分页查询数据
export const getConfigurationData = (data) => {
  return dataAxios({
    url: `/tmfsExamPlatform/configuration/search`,
    method: "post",
    data: data,
  });
};
//新增数据
export const addConfigurationData = (data) => {
  return dataAxios({
    url: `/tmfsExamPlatform/configuration/add`,
    method: "post",
    data: data,
  });
};
//修改数据
export const editConfigurationData = (data) => {
  return dataAxios({
    url: `/tmfsExamPlatform/configuration/edit`,
    method: "PUT",
    data: data,
  });
};
//删除数据
export const deleteConfigurationData = (id) => {
  return dataAxios({
    url: `/tmfsExamPlatform/configuration/delete/` + id,
    method: "DELETE",
  });
};
//查询单个
export const searchConfigurationData = (parentId) => {
  return dataAxios({
    url: "/tmfsExamPlatform/configuration/search",
    params: { parentId: parentId },
    method: "GET",
  });
};

//======================评定管理======================
//查询最新评定数据
export const searchReviewData = (data) => {
  return dataAxios({
    url: `/tmfs/review/searchLast`,
    method: "POST",
    data: data,
  });
};
//查询历史评定数据
export const searchHistoryReviewData = (data) => {
  return dataAxios({
    url: `/tmfs/review/searchHistory`,
    method: "POST",
    data: data,
  });
};
export const searchMyReviewData = (data) => {
  return dataAxios({
    url: `/tmfs/review/search/my`,
    method: "POST",
    data: data,
  });
};
//新增评定任务
export const addReviewData = (data) => {
  return dataAxios({
    url: `/tmfs/review/add`,
    method: "POST",
    data: data,
  });
};
//删除评定任务
export const deleteReviewData = (data) => {
  return dataAxios({
    url: `/tmfs/review/batch/del`,
    method: "PUT",
    data: data,
  });
};
//修改评定
export const editReviewData = (data) => {
  return dataAxios({
    url: `/tmfs/review/edit`,
    method: "POST",
    data: data,
  });
};
//执行评定
export const executeReviewData = (data) => {
  return dataAxios({
    url: `/tmfs/review/batch/execute`,
    method: "put",
    data: data,
  });
};
//设置评定人
export const assignReviewData = (data) => {
  return dataAxios({
    url: `/tmfs/review/batch/assign`,
    method: "put",
    data: data,
  });
};
//设置计划结束时间
export const planEndTimeReviewData = (data) => {
  return dataAxios({
    url: `/tmfs/review/batch/planEndTime`,
    method: "put",
    data: data,
  });
};
//发布评定结果
export const publishReviewData = (data) => {
  return dataAxios({
    url: `/tmfs/review/batch/publishStatus`,
    method: "put",
    data: data,
  });
};
//导入
export const importReviewData = () => {
  return dataAxios({
    url: `/tmfs/review/import/async`,
    method: "post",
  });
};
//导出
export const exportReviewData = (data) => {
  return dataAxios({
    url: `/tmfs/review/export/async`,
    method: "post",
    data: data,
    // responseType:'blob'
  });
};
//模板下载
export const downloadImportReviewModal = () => {
  return dataAxios({
    url: `/tmfs/review/downloadTemplate`,
    method: "get",
    responseType: "blob",
  });
};

//======================专家管理======================
//根据工号查询单独的员工信息
export function getEmpByEmpNo (param) {
  return dataAxios({
    url: `/tmfs/emp/findEmpByIdOrName`,
    method: "get",
    params: param,
  });
}
//查询专家列表
export function searchExpertList (param) {
  return dataAxios({
    url: `/tmfs/expertInfo`,
    method: "get",
    params: param,
  });
}
//修改专家
export function editExpertInfo (data) {
  return dataAxios({
    url: `/tmfs/expertInfo`,
    method: "put",
    data: data,
  });
}
//新增专家
export function addExpertInfo (data) {
  return dataAxios({
    url: `/tmfs/expertInfo`,
    method: "post",
    data: data,
  });
}
//删除专家
export function deleteExpert (param) {
  return dataAxios({
    url: `/tmfs/expertInfo?ids=` + param,
    method: "delete",
  });
}
//专家模糊查询
export function searchExpert (data) {
  return dataAxios({
    url: `/tmfs/expertInfo/search`,
    method: "post",
    data: data,
  });
}

//======================导入导出======================
//查询
export function queryTask (param) {
  return dataAxios({
    url: `/tmfs/excelTask/queryTask`,
    method: "get",
    params: param,
  });
}
//下载
// export function downloadById(param) {
//   return dataAxios({
//     url: `/tmfs/excelTask/downloadById`,
//     method: 'get',
//     params: param,
//     responseType: 'blob',
//   })
// }
export function downloadById (url, fileName) {
  return dataAxios({
    url: url,
    method: "get",
    responseType: "blob",
  });
}
//删除
export function delById (id) {
  return dataAxios({
    url: `/tmfs/excelTask/delByIds?ids=` + id,
    method: "delete",
  });
}

//======================报表管理======================
//查询考试报表
export function queryExamPage (param) {
  return dataAxios({
    url: `/tmfs/reportForm/queryExamPage`,
    method: "get",
    params: param,
  });
}
//下载考试报表
export function asyncExamExport (param) {
  return dataAxios({
    url: `/tmfs/reportForm/asyncExamExport`,
    method: "get",
    params: param,
  });
}
//查询档案报表
export function queryRecordPage (param) {
  return dataAxios({
    url: `/tmfs/reportForm/queryRecordPage`,
    method: "get",
    params: param,
  });
}
//下载档案报表
export function asyncRecordExport (param) {
  return dataAxios({
    url: `/tmfs/reportForm/asyncRecordExport`,
    method: "get",
    params: param,
  });
}

//======================我的信息======================
//考试
export function getMyExamData () {
  return dataAxios({
    url: `/tmfs/exam/getMyExamList`,
    method: "get",
  });
}
//评定
export function getMyReviewData () {
  return dataAxios({
    url: `/tmfs/review/search/myList`,
    method: "get",
  });
}
//专家
export function getMyExpertData () {
  return dataAxios({
    url: `/tmfs/expertInfo/getMyExpert`,
    method: "get",
  });
}
//证书
export function getMyCertificateData () {
  return dataAxios({
    url: `/tmfs/certificateManager/getMyCertificate`,
    method: "get",
  });
}

//======================映射配置======================

export function getMapData (params) {
  return dataAxios({
    url: `/tmfs/dataConfig`,
    method: "get",
    params: params,
  });
}
export function addMapData (data) {
  return dataAxios({
    url: `/tmfs/dataConfig`,
    method: "post",
    data: data,
  });
}
export function editMapData (data) {
  return dataAxios({
    url: `/tmfs/dataConfig`,
    method: "put",
    data: data,
  });
}
export function deleteMapData (params) {
  return dataAxios({
    url: `/tmfs/dataConfig?ids=` + params,
    method: "delete",
  });
}
//======================科目关联======================
//获取
export function getExamData (params) {
  return dataAxios({
    url: `/tmfs/examConfig`,
    method: "get",
    params: params,
  });
}
//新增
export function addExamData (data) {
  return dataAxios({
    url: `/tmfs/examConfig`,
    method: "post",
    data: data,
  });
}
//修改
export function editExamData (data) {
  return dataAxios({
    url: `/tmfs/examConfig`,
    method: "put",
    data: data,
  });
}
//删除
export function deleteExamData (params) {
  return dataAxios({
    url: `/tmfs/examConfig?ids=` + params,
    method: "delete",
  });
}

//======================考试台账======================
//查询
export function getExamBasicInfo (params) {
  return dataAxios({
    url: `/tmfs/examBasicInfo/queryPage`,
    method: "get",
    params: params,
  });
}
//ids导出 同步
export function exportExamBasicInfo (ids) {
  return `/tmfs/examBasicInfo/exportIds?ids=` + ids;
}
//全部导出 异步
export function exportAllExamBasicInfo (params) {
  return dataAxios({
    url: `/tmfs/examBasicInfo/exportAsync`,
    method: "get",
    params: params,
  });
}
//修改
export function editExamBasicInfo (data) {
  return dataAxios({
    url: `/tmfs/examBasicInfo`,
    method: "put",
    data: data,
  });
}
//获取统计信息
export function getHistogram (params) {
  return dataAxios({
    url: `/tmfs/examStatistical/histogram`,
    method: "get",
    params: params,
  });
}
//导出统计信息
export function exportHistogram (params) {
  return dataAxios({
    url: `/tmfs/examStatistical/histogramExportExcel`,
    method: "get",
    params: params,
  });
}
//获取趋势图
export function getLine (params) {
  return dataAxios({
    url: `/tmfs/examStatistical/trendLine`,
    method: "get",
    params: params,
  });
}
//导出趋势图
export function exportLine (params) {
  let url = `/tmfs/examStatistical/trendLineExportExcel?`;
  for (let key in params) {
    url = url + key + "=" + params[key] + "&";
  }
  if (JSON.stringify(params) != {}) url = url.substring(0, url.length - 1);
  return url;
}
//获取同步时间
export function getLastCompleteDate (params) {
  return dataAxios({
    url: `/tmfs/examStatistical/getLastCompleteDate`,
    method: "get",
    params: params
  });
}
export function getNextCompleteDate (params) {
  return dataAxios({
    url: `/tmfs/examStatistical/nextDataComputeTime`,
    method: "get",
    params: params
  });
}